package com.example.control;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/order")
public class OrderController {

    @Resource
    private RestTemplate restTemplate;

    @RequestMapping(value = "/add.json")
    public String add() {
        System.out.println("添加订单!!");
        String result = restTemplate.getForObject("http://stock-nacos/stock/deduct.json", String.class);
        return "add order success!!" +result;
    }
}
